﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="manufacturar.aspx.cs" Inherits="Main_Master_manufacturar" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Manufacture</title>
    <link href="../../Styles/accounts.css" rel="Stylesheet" type="text/css" />
    <style type="text/css">
        .WaterMark
        {
            color: #808080;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="divmain" align="center">
        <asp:Panel ID="pnlData" runat="server" Visible="false">
            <acc:heading ID="header1" runat="server" HeadingText="Manufacturer" />
            <asp:Label ID="lblMessage" runat="server" Style="display: none;"></asp:Label>
            <div style="margin-left: 5%; margin-right: 5%; margin-top: 15px;">
                <table cellpadding="0" cellspacing="0" class="tablecontent" width="60%">
                    <tr>
                        <td class="headtd" colspan="2">
                            Add Manufacturer
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="height: 18px;">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            Manufacturer Name &nbsp;&nbsp;
                        </td>
                        <td>
                            <asp:TextBox ID="txtManufacturer" runat="server" onFocus="Hide();" CssClass="input"
                                MaxLength="50" Width="300px"></asp:TextBox>
                            <script type="text/javascript">
                                function Hide() {
                                    document.getElementById("lblMessage").style["display"] = "none";
                                }
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnSaveManufacture" CssClass="button" runat="server" Text=" Add Manufacturer "
                                Width="130px" OnClick="btnSaveManufacture_Click" OnClientClick="return CheckText();" />
                            <script type="text/javascript">
                                function CheckText() {
                                    if (document.getElementById("txtManufacturer").value == '') {
                                        document.getElementById("lblMessage").innerHTML = "Please Enter the Manufacturer Name.";
                                        document.getElementById("lblMessage").style["display"] = "block";
                                        document.getElementById("lblMessage").style["color"] = "#B90000";
                                        return false;
                                    }
                                }
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="height: 18px;">
                        </td>
                    </tr>
                </table>
            </div>
        </asp:Panel>
        <asp:Panel ID="pnlview" runat="server" Visible="false">
            <acc:heading ID="pagehead" runat="server" HeadingText="Manufacturer View" />
            <asp:Label ID="lblViewMessage" runat="server" Style="display: none;"></asp:Label>
            <div style="margin-left: 10%; background-color: #EEEEEE; height: 30px; margin-right: 10%;">
                <div style="width: 100%;">
                    <table width="100%">
                        <tr>
                            <td style="width: 5%;">
                                &nbsp;&nbsp;&nbsp;<asp:ImageButton ID="imgpdf" ToolTip="Export To PDF" runat="server"
                                    ImageUrl="~/Images/PDF.png" OnClick="imgpdf_Click" />
                            </td>
                            <td style="width: 5%;">
                                &nbsp;&nbsp;&nbsp;<asp:ImageButton ID="imgword" runat="server" ToolTip="Export To Word"
                                    ImageUrl="~/Images/word_icon.png" OnClick="imgword_Click" />
                            </td>
                            <td style="width: 60%;">
                                &nbsp;&nbsp;&nbsp;<asp:ImageButton ID="imgxl" runat="server" ToolTip="Export To Excel"
                                    ImageUrl="~/Images/Excel.png" OnClick="imgxl_Click" />
                            </td>
                            <td style="width: 10%;">
                                <span>Search</span>
                            </td>
                            <td style="width: 10%;">
                                <asp:TextBox ID="txtSearchManufacture" onFocus="ViewHide();" runat="server" Width="180px"
                                    CssClass="input"></asp:TextBox>
                                <script type="text/javascript">
                                    function ViewHide() {
                                        document.getElementById("lblViewMessage").style["display"] = "none";
                                    }
                                </script>
                            </td>
                            <td style="width: 10%;">
                                <asp:Button ID="btnsearch" runat="server" OnClientClick="return ValidationSearch();"
                                    Width="70px" Text="Search" CssClass="button" OnClick="btnsearch_Click" />
                                <script type="text/javascript">
                                    function ValidationSearch() {
                                        if (document.getElementById("txtSearchManufacture").value == '') {
                                            document.getElementById("lblViewMessage").innerHTML = "Please Enter the Search Criteria.";
                                            document.getElementById("lblViewMessage").style["display"] = "block";
                                            document.getElementById("lblViewMessage").style["color"] = "#B90000";
                                            return false;
                                        }
                                    }
                                </script>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:GridView ID="grdmanuview" runat="server" CssClass="gridview" AutoGenerateColumns="False"
                AllowPaging="True" OnPageIndexChanging="grdmanuview_PageIndexChanging" OnRowCancelingEdit="grdmanuview_RowCancelingEdit"
                DataKeyNames="ManufacID" Width="80%" OnRowEditing="grdmanuview_RowEditing" OnRowUpdating="grdmanuview_RowUpdating"
                PageSize="40" OnRowCommand="grdmanuview_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="Sr.No">
                        <ItemTemplate>
                            <%#Container.DataItemIndex+1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        Manufacture Name
                                    </td>
                                    <td>
                                        <asp:ImageButton ID="LinkButtonEmpName" runat="server" CommandName="Sort" CommandArgument="manufactureName"
                                            ImageUrl="~/Images/sort.png" />
                                    </td>
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblmanuname" runat="server" Text='<%#Bind("manufactureName")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtmanufacturer" MaxLength="50" CssClass="input" Width="350px" runat="server"
                                Text='<%#Bind("manufactureName")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="Edit"></asp:LinkButton>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return CheckUpdate();"
                                CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
                            <script type="text/javascript">
                                function CheckUpdate() {
                                    var f = document.getElementById("grdmanuview");
                                    for (var i = 0; i < f.getElementsByTagName("input").length; i++) {
                                        if (f.getElementsByTagName("input").item(i).type == "text") {
                                            if (f.getElementsByTagName("input").item(i).value == 0) {                                                
                                                document.getElementById("lblViewMessage").innerHTML = "Please Enter the Data for Update.";
                                                document.getElementById("lblViewMessage").style["display"] = "block";
                                                document.getElementById("lblViewMessage").style["color"] = "#B90000";
                                                f.getElementsByTagName("input").item(i).focus();
                                                return false;
                                            }
                                        }
                                    }
                                }
                            </script>
                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="Cancel"></asp:LinkButton>
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
